/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component} from 'react';
import {Form, Input,  Alert, TreeSelect,DatePicker,Select ,Radio } from 'antd';
import {connect} from 'dva';
const FormItem = Form.Item;
const Option = Select.Option;
const RadioGroup = Radio.Group;
import moment from 'moment'
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }
  componentDidMount() {
  }
  render() {
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 7},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };
    const {getFieldDecorator} = this.props.form;

    return (
      <div>
      <Form onSubmit={this.handleSubmit}>
       <FormItem label= '开始日期'
                  {...formItemLayoutWithLabel}>
          {getFieldDecorator('started_at', {
            initialValue: moment(),
            rules: [{required: true}],

          })(
            <DatePicker
              style={{width:'100%'}}
              allowClear={false}
              format="YYYY-MM-DD"
            />
          )}
        </FormItem>
          <FormItem label= '结束日期'
                  {...formItemLayoutWithLabel}>
          {getFieldDecorator('ended_at', {
            rules: [{required: true}],
            initialValue: moment(),
          })(
            <DatePicker
              style={{width:'100%'}}
              allowClear={false}
              format="YYYY-MM-DD"
            />
          )}
        </FormItem>
        <FormItem label={'银行'}       {...formItemLayoutWithLabel}>
          {getFieldDecorator('bank_id', {
            initialValue: {key:'',label:''},
          })(
            <Select allowClear={true} labelInValue={true}>
              { this.props.banks.map(item => <Option key={item.id} value={item.id}>{item.name}</Option>) }
            </Select>
          )}
        </FormItem>
        <FormItem
          {...formItemLayoutWithLabel}
          label={(
            <span>
               状态
            </span>
          )}
        >
          {getFieldDecorator('status', {
            initialValue: '',
          })(
            <RadioGroup>
              <Radio value="">全部</Radio>
              <Radio value="2">审核通过</Radio>
              <Radio value="1">等待审核</Radio>
              <Radio value="-1">审核不通过</Radio>
            </RadioGroup>
          )}
        </FormItem>
        <FormItem
          {...formItemLayoutWithLabel}
          label={(
            <span>
               车牌号码
            </span>
          )}
        >
          {getFieldDecorator('license_plate_number', {
            initialValue: '',
          })(
            <Input/>
          )}
        </FormItem>
        <FormItem
          {...formItemLayoutWithLabel}
          label={(
            <span>
               手机号码
            </span>
          )}
        >
          {getFieldDecorator('mobile', {
            initialValue: '',
          })(
            <Input/>
          )}
        </FormItem>
        <div style={{width:'80%',margin:'0 auto'}}>
          <Alert message="银行,状态,车牌号码,分手机号码为空则导出全部" type="warning" />
        </div>

      </Form>
    </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);
